#ifdef WX_PRECOMP
#include "../wx_pch.h"
#else
#include <wx/wx.h>
#endif //WX_PRECOMP

#include "race_info_panel.h"
#include "../race_item.h"

namespace
{
  void PutValue(wxStaticText* control, double value)
  {
    control->SetLabel(wxString::Format(wxT("%+.1f"), value));
  }
} // end of anonymous namespace

RaceInfoPanel::RaceInfoPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos,
    const wxSize& size, long style)
  : RaceInfoPanelBase(parent, id, pos, size, style)
{
  ShowFullInfo(false);
}

RaceInfoPanel::~RaceInfoPanel()
{
}

void RaceInfoPanel::SetRace(const RaceItem& race)
{
  PutValue(StaticValueT1, race.BonusTemperatureDelta);
  PutValue(StaticValueT2, race.BonusGrow);
  PutValue(StaticValue1,  race.BonusSpeed);
  PutValue(StaticValue2,  race.BonusDefence);
  PutValue(StaticValue3,  race.BonusPrice);
  PutValue(StaticValueT3, race.BonusScience);
  PutValue(StaticValue4,  race.BonusCivilProduction);
  PutValue(StaticValue5,  race.BonusMilitaryProduction);
  PutValue(StaticValue6,  race.BonusHitPoints);
  PutValue(StaticValue7,  race.BonusDamage);
  PutValue(StaticValueT4, race.BonusMiningSpeed);
  PutValue(StaticValue8,  race.BonusStealth);
  PutValue(StaticValue9,  race.BonusDetection);
  InfoSizer->Layout();
}

void RaceInfoPanel::ShowFullInfo(bool full)
{
  StaticTextT1->Show(full);
  StaticValueT1->Show(full);
  StaticTextT2->Show(full);
  StaticValueT2->Show(full);
  StaticTextT3->Show(full);
  StaticValueT3->Show(full);
  StaticTextT4->Show(full);
  StaticValueT4->Show(full);
}
